package com.blue.jdbc.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.blue.jdbc.JdbcDataSource;
import com.blue.jdbc.dao.MenuDao;
import com.blue.jdbc.model.Menu;

@Service
@Transactional
@JdbcDataSource("ds_admin")
public class MenuService
{
	@Resource
	private MenuDao menuDao;
	
	public MenuService()
	{
	}
	
	public void save(Menu menu)
	{
		if (menu.getId() == null)
		{
			menuDao.save(menu);
		}
		else
		{
			menuDao.update(menu);
		}
	}
	
	public Menu get(Integer id)
	{
		return menuDao.get(id);
	}
	
	
}
